﻿@model AcquisitionIM

@{
    ViewBag.Title = "采集" + EntityNames.Article;
    ViewBag.PageTitle = ViewBag.Title + "_内容";

}
@section Header{

}

@using (Ajax.BeginForm("Acquisition", null, new AjaxOptions
{
    HttpMethod = "POST",
    OnBegin = "onBeginSave",
    OnComplete = "onCompleteSave",
    OnSuccess = "updateSuccess"

}, new { @class = "form-horizontal", role = "form" }))
{

    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div class="panel panel-default">
        <header class="panel-heading">
            <span class="glyphicon glyphicon-edit"></span> @ViewBag.Title
        </header>

        <section class="panel-body">

            <div class="form-group">
                @Html.LabelFor(model => model.CategoryId, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.DropDownListFor(model => model.CategoryId, (SelectList)ViewBag.Categories, new { @class = "form-control", placeholder = Labels.Category })
                    @Html.ValidationMessageFor(model => model.CategoryId)
                </div>

            </div>


            <div class="form-group">
                @Html.LabelFor(model => model.TemplateId, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.DropDownListFor(model => model.TemplateId, (SelectList)ViewBag.Templates, new { @class = "form-control", placeholder = Labels.TemplateName })
                    @Html.ValidationMessageFor(model => model.TemplateId)
                </div>

            </div>


            <div class="form-group">
                @Html.LabelFor(model => model.Count, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Count, new { @class = "form-control", placeholder = Labels.Quantity })
                    @Html.ValidationMessageFor(model => model.Count)
                </div>
            </div>


        </section>
        <footer class="panel-footer text-center">
            <button type="submit" class="btn btn-primary" id="btnSave"><i class="fa fa-save fa-fw"></i>  @Buttons.Add </button>
            <a href="@Url.Action("Index")" class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> @Buttons.Back</a>
        </footer>

    </div>

}

@Html.Action("PopuFinder", "File")

@section Footer {

    @Scripts.Render("~/bundles/jqueryvalWithBootstrap")

    <script>


    function onBeginSave() {
        $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin");
    }
    function onCompleteSave() {
        $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save");
    }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
        Common.ShowBox(data.Status, data.Message, title);
    }





        $(function () {

        })
    </script>
}

